CMAKE_MINIMUM_REQUIRED(VERSION 3.1)

# Project properties
SET(PROJECT_ORG gepetto)
SET(PROJECT_NAME example-robot-data)
SET(PROJECT_DESCRIPTION "Set of robot URDFs for benchmarking and developed examples.")
SET(PROJECT_URL https://gepgitlab.laas.fr/${PROJECT_ORG}/${PROJECT_NAME})

# Project options
OPTION(BUILD_PYTHON_INTERFACE "Build the python unit tests and helpers" ON)
OPTION(INSTALL_PYTHON_INTERFACE_ONLY "Install *ONLY* the python interface" OFF)

# Project configuration
IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
  SET(PROJECT_USE_CMAKE_EXPORT TRUE)
ENDIF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
SET(CUSTOM_HEADER_DIR ${PROJECT_NAME})

# JRL-cmakemodule setup
INCLUDE(cmake/base.cmake)
INCLUDE(cmake/python.cmake)

# Print initial message
MESSAGE(STATUS "${PROJECT_DESCRIPTION}, version ${PROJECT_VERSION}")
MESSAGE(STATUS "Copyright (C) 2018-2020 LAAS-CNRS / University of Edinburgh")
MESSAGE(STATUS "All rights reserved.")
MESSAGE(STATUS "Released under the BSD 3-Clause License.")

# Project definition
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})

IF(BUILD_PYTHON_INTERFACE)
  ADD_PROJECT_DEPENDENCY(pinocchio)
  FINDPYTHON()
  STRING(REGEX REPLACE "-" "_" PY_NAME ${PROJECT_NAME})
  ADD_SUBDIRECTORY(python)
  IF(BUILD_TESTING)
    ADD_SUBDIRECTORY(unittest)
  ENDIF(BUILD_TESTING)
ENDIF(BUILD_PYTHON_INTERFACE)

IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
  ADD_LIBRARY(${PROJECT_NAME} INTERFACE)
  TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} INTERFACE $<INSTALL_INTERFACE:include>)
  INSTALL(TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)

  ADD_SUBDIRECTORY(include/${CUSTOM_HEADER_DIR})
  INSTALL(DIRECTORY robots DESTINATION share/${PROJECT_NAME})
  INSTALL(FILES package.xml DESTINATION share/${PROJECT_NAME})
ENDIF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
